-- dbService管理数据库连接
local skynet = require "skynet"
local redis = require 'skynet.db.redis'

local CMD = {}
local db

function CMD.getDb()
    return db
end

function CMD.start(conf)
    local redisConfig = {
        host = '127.0.0.1',
        port = 6379,
        db = 0
    }
    db = redis.connect(redisConfig)
end

skynet.start(function()
    skynet.dispatch("lua", function(_, _, command, ...)
        print("userManager Command:", command)
        local f = CMD[command]
        skynet.ret(skynet.pack(f(...)))
    end)
end)
